package com.kehao.others.tencent;

import java.util.Scanner;

public class Question5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] price = new int[n];
        for (int i = 0; i < n; i++) {
            price[i] = sc.nextInt();
        }
        int[][] dp = new int[n][2];
        int[][] keep = new int[n][2];
        dp[0][0] = m;
        dp[0][1] = m;
        keep[0][0] = 0;
        while (dp[0][1]-price[0]>=0){
            dp[0][1] = dp[0][1]-price[0];
            keep[0][1]++;
        }

        for (int i = 1; i < n; i++) {
            dp[i][1] = dp[i][0] = Integer.MIN_VALUE;
            for (int j = 0; j < i; j++) {
//            dp[i][0]
                int val1 = Integer.MIN_VALUE,val2 = Integer.MIN_VALUE;
                if(dp[j][0]>=0){
                    val1 = dp[j][0];
                    keep[i][0] = keep[j][0];
                }
                if(dp[j][1]>=0){
                    val2 = dp[j][1] + keep[j][1]*price[i];
                    keep[i][0] = 0;
                }
                int candidate = Integer.max(val1, val2);
                dp[i][0] = Integer.max(candidate,dp[i][0]);
//                dp[i][1]
                val1 = val2 = Integer.MIN_VALUE;
                if(dp[j][1]>=0){
                    val1 = dp[j][1];
                    keep[i][1] = keep[j][1];
                }
                keep[i][1] = 0;
                val2 = dp[j][0];
                while (val2>=price[i]){
                    val2 = val2-price[i];
                    keep[i][1]++;
                }
                candidate = Integer.max(val1, val2);
                dp[i][1] = Integer.max(candidate,dp[i][1]);
            }
        }
        System.out.println(Integer.max(dp[n-1][0],dp[n-1][1]));
    }
}
